<?
	include_once('header.php');
	include_once('sidebar.php');
	extract($_GET);
?>
	<div id="main">
		<h2>Warehouse</h2>
		<br class="clear" />
<?
	if($id) {
		if($_POST) {
			echo drizzo_warehouse_restore($id);
		}
		$the_revision = drizzo_warehouse_revision($id);
		$the_post = drizzo_get_the_post($the_revision['old_id']);
		$revs = drizzo_warehouse_compare($the_revision['content'],$the_post['content']);
?>
		<div id="left">
			<h3>Warehouse Revision</h3>
			<p><strong><? if($the_revision['title'] == $the_post['title']) { echo $the_revision['title']; } else { echo "<span class=\"rev_change\">" . $the_revision['title'] . "</span>"; } ?></strong></p>
			<div id="revision_content">
				<? echo nl2br($revs['warehouse']); ?>
			</div>
			<hr class="rule" />
			<p>Posted by <strong><? echo $the_revision['author_nicename']; ?></strong> on <strong><? echo $the_revision['posted_date']; ?></strong></p>
			<p>Last edited by <strong><? echo $the_revision['editor_nicename']; ?></strong> on <strong><? echo $the_revision['edited_date']; ?></strong></p>
			<p class="tags_meta"><strong>Tags:</strong> <? echo $the_revision['tags']; ?></p>
			<p><strong>Status:</strong> <? echo ucwords($the_revision['status']); ?></p>
			<p><strong>Type:</strong> <? echo ucwords($the_revision['type']); ?></p>
		</div>
		<div id="right">
			<h3>Current Revision</h3>
			<p><strong><? if($the_revision['title'] == $the_post['title']) { echo $the_post['title']; } else { echo "<span class=\"rev_change\">" . $the_post['title'] . "</span>"; } ?></strong></p>
			<div id="post_content">
				<? echo nl2br($revs['post']); ?>
			</div>
			<hr class="rule" />
			<p>Posted by <strong><? if($the_post['author'] == $the_revision['author']) { echo $the_post['author_nicename']; } else { echo "<span class=\"rev_change\">" . $the_post['author_nicename'] . "</span>"; } ?></strong> on <strong><? if($the_post['posted_date'] == $the_revision['posted_date']) { echo $the_post['posted_date']; } else { echo "<span class=\"rev_change\">" . $the_post['posted_date'] . "</span>"; } ?></strong></p>
			<p>Last edited by <strong><? if($the_post['editor'] == $the_revision['editor']) { echo $the_post['editor_nicename']; } else { echo "<span class=\"rev_change\">" . $the_post['editor_nicename'] . "</span>"; } ?></strong> on <strong><? if($the_post['edited_date'] == $the_revision['edited_date']) { echo $the_post['edited_date']; } else { echo "<span class=\"rev_change\">" . $the_post['edited_date'] . "</span>"; } ?></strong></p>
			<p class="tags_meta"><strong>Tags:</strong> <? if($the_post['tags'] == $the_revision['tags']) { echo $the_post['tags']; } else { echo "<span class=\"rev_change\">" . $the_post['tags'] . "</span>"; } ?></p>
			<p><strong>Status:</strong> <? if($the_post['status'] == $the_revision['status']) { echo ucwords($the_post['status']); } else { echo "<span class=\"rev_change\">" . ucwords($the_post['status']) . "</span>"; } ?></p>
			<p><strong>Type:</strong> <? if($the_post['type'] == $the_revision['type']) { echo ucwords($the_post['type']); } else { echo "<span class=\"rev_change\">" . ucwords($the_post['type']) . "</span>"; } ?></p>
			<form method="post" action="" name="warehouse_restore" id="warehouse_restore">
				<p class="right"><input type="hidden" name="dummy" value="1" /><input type="button" onclick="history.go(-1)" value="Go Back" class="submit" /> <input type="submit" value="Restore the Previous Revision" class="submit" onclick="return warehouseConfirm()" /></p>
			</form>
		</div>
<?
	} else {
?>
		<p>You have not selected a Warehouse Revision to compare.</p>
<?
	}
?>
		<br class="clear" />
	</div>
<?
	include_once('footer.php');
?>